﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BIZ;

namespace VIEW
{
    public partial class login : Form
    {
        public login()
        {
            InitializeComponent();

            this.skinEngine1.SkinFile = "MacOS.ssk";
        }
        static void Main()
        {
            Application.Run(new login());  
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string userName = textBox1.Text;
            string passwd = textBox2.Text;
            int i;
            int purview = -10;

            if ((radioButton1.Checked == false) && (radioButton2.Checked == false) && (radioButton3.Checked == false))
            {
                MessageBox.Show("请选择用户类型");
            }
            else
            {
                purview = 10;
            }

            LoginBIZ formBiz = new LoginBIZ();

            i = formBiz.CheckPasswd(userName, passwd);

            
            if (purview != -2)
            {
                if (i == 0)
                {
                    //this.textBox1.Clear();
                    if (radioButton1.Checked)
                    {
                        StudentVIEW studentView = new StudentVIEW(textBox1.Text);
                        studentView.ShowDialog();
                        textBox1.Clear();
                        textBox2.Clear();
                    }
                    else
                    {
                        MessageBox.Show("请选择正确的用户类型");
                    }
                }
                else if (i == 1)
                {
                    if (radioButton2.Checked)
                    {
                        TeacherVIEW techerView = new TeacherVIEW(textBox1.Text);
                        techerView.ShowDialog();
                        textBox1.Clear();
                        textBox2.Clear();
                    }
                    else
                    {
                        MessageBox.Show("请选择正确的用户类型");
                    }
                }
                else if (i == 2)
                {
                    if (radioButton3.Checked)
                    {
                        ActorVIEW actorView = new ActorVIEW(textBox1.Text);
                        actorView.ShowDialog();
                        textBox1.Clear();
                        textBox2.Clear();
                    }
                    else
                    {
                        MessageBox.Show("请选择正确的用户类型");
                    }
                }

                else
                {
                    
                    MessageBox.Show("请确认用户名和密码正确");
                }
                
            }
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void login_Load(object sender, EventArgs e)
        {

        }

      
    }
}